/**
 * 用户签到相关接口类型定义
 */

import { BaseApiResponse } from "./interface";



// 签到结果
export interface SignInResult {
  success: boolean;
  signInId?: string;
  experienceGained?: number;
  pointsGained?: number;
  consecutiveDays?: number;
  isConsecutive?: boolean;
  todayAlreadySigned?: boolean;
  rewardDetails?: {
    experience?: number;
    points?: number;
    specialReward?: any;
  };
}

export interface SignInApiResponse extends BaseApiResponse<SignInResult> { }

// 签到统计
export interface SignInStats {
  totalSignInDays: number;
  consecutiveDays: number;
  currentMonthSignInDays: number;
  lastSignInDate?: Date;
  todaySignedIn: boolean;
  totalExperienceGained: number;
  totalPointsGained: number;
  longestConsecutiveDays: number;
}

export interface SignInStatsApiResponse extends BaseApiResponse<SignInStats> { }

// 签到记录
export interface SignInRecord {
  id: string;
  signInDate: Date;
  signInTime: Date;
  experienceGained: number;
  pointsGained: number;
  isConsecutive: boolean;
  consecutiveDays: number;
  signInType: number; // 1: 正常签到, 2: 补签
  signIp?: string;
  rewardDetails?: any;
}

// 签到记录列表响应
export interface SignInListResponse {
  records: SignInRecord[];
  total: number;
  page: number;
  size: number;
  totalPages: number;
}

export interface SignInListApiResponse extends BaseApiResponse<SignInListResponse> { }

// 签到日历项
export interface SignInCalendarItem {
  date: string; // YYYY-MM-DD 格式
  signedIn: boolean;
  isConsecutive?: boolean;
  experienceGained?: number;
  pointsGained?: number;
  canMakeUp?: boolean; // 是否可以补签
}

// 签到日历响应
export interface SignInCalendarResponse {
  year: number;
  month: number;
  calendar: SignInCalendarItem[];
  monthStats: {
    totalSignInDays: number;
    totalExperienceGained: number;
    totalPointsGained: number;
  };
}

export interface SignInCalendarApiResponse extends BaseApiResponse<SignInCalendarResponse> { }

// 补签结果
export interface MakeUpSignInResult {
  success: boolean;
  signInId?: string;
  signInDate: string;
  experienceGained?: number;
  pointsGained?: number;
  costPoints?: number; // 补签消耗的积分
  rewardDetails?: {
    experience?: number;
    points?: number;
  };
}

export interface MakeUpSignInApiResponse extends BaseApiResponse<MakeUpSignInResult> { }
